﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace XqWebSite
{
    public partial class WebForm35 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Btn_tj_Click(object sender, EventArgs e)
        {
            if (this.Tex_x.Text == "" || this.Tex_c.Text == "")
            {
                Response.Write("<script>alert('密码不能为空！');document.location=document.location;</script>");
            }
            if (this.Tex_jiu.Text != (string)Session["PWD"])
            {
                Response.Write("<script>alert('旧密码不对！');document.location=document.location;</script>");
            }
            else if (this.Tex_x.Text == this.Tex_c.Text)
            {
                string sql = "update WeiXiuRenYuan set PassWord='" + this.Tex_x.Text + "' where UserName='" + Session["UserName"].ToString() + "'";
                bool b = DBHelper.ExecSql(sql);
                if (b)
                {
                    Response.Write("<script>alert('操作成功！');document.location=document.location;</script>");
                }
                else
                {
                    Response.Write("<script>alert('操作失败！');document.location=document.location;</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('2次输入的密码不一致！');document.location=document.location;</script>");
            }
        }


        protected void But_qx_Click(object sender, EventArgs e)
        {
            this.Tex_jiu.Text = "";
            this.Tex_x.Text = "";
            this.Tex_c.Text = "";
        }
    }
}